package com.cpi.cornpp.costelement.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm;

import com.cpi.cornpp.costelement.view.CostElementView;
import com.cpi.cornpp.transports.view.TransportView;

public class CostElementForm extends ValidatorForm{
	/** Serial ID*/
	private static final long serialVersionUID = -9101874787214700030L;
	/** Empty string */
	private static final String EMPTY = "";//$NON-NLS-1$
	private int transportIndex;
	private String createNewCostElement;
	/**Cost Element View*/
	private CostElementView costElementView;
	private TransportView transportView;
	
	public CostElementForm(){
		super();
		transportIndex = -1;
		transportView = new TransportView();
		costElementView = new CostElementView();
	}
	
	public int getTransportIndex() {
		return transportIndex;
	}

	public void setTransportIndex(int aTransportIndex) {
		transportIndex = aTransportIndex;
	}

	public String getCreateNewCostElement() {
		return createNewCostElement;
	}

	public void setCreateNewCostElement(String aCreateNewCostElement) {
		createNewCostElement = aCreateNewCostElement;
	}

	/**
	 * @param costElementView the costElementView to set
	 */
	public void setCostElementView(CostElementView costElementView) {
		this.costElementView = costElementView;
	}

	/**
	 * @return the costElementView
	 */
	public CostElementView getCostElementView() {
		return costElementView;
	}
	
	public TransportView getTransportView() {
		return transportView;
	}

	public void setTransportView(TransportView aTransportView) {
		transportView = aTransportView;
	}

	/**
	 * Reset method
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		costElementView.setCostElementID(-1);
		costElementView.setCostElementCode(EMPTY);
		costElementView.setCostElementDescription(EMPTY);
		transportView.setTransportIdentifier(-1);
		transportView.setTransportShortName(null);
	}
}